package com.hying.util;

import lombok.Data;

/**
 * @author liuhongfeng
 * @date 2019/2/15 17:55
 */
@Data
public class R {

    private String code;
    private String msg;
    private Object data;

    public static R succ(String mess) {
        R m = new R();
        m.setCode("200");
        m.setData(null);
        m.setMsg(mess);

        return m;
    }

    public static R succ(String mess, Object data) {
        R m = new R();
        m.setCode("200");
        m.setData(data);
        m.setMsg(mess);

        return m;
    }

    public static R fail(String mess) {
        R m = new R();
        m.setCode("400");
        m.setData(null);
        m.setMsg(mess);

        return m;
    }

    public static R fail(String mess, Object data) {
        R m = new R();
        m.setCode("400");
        m.setData(data);
        m.setMsg(mess);

        return m;
    }
}
